﻿/*
 * See product pages for more information.
 * hrondra, 2010
 */

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Close.Classes;

namespace Close
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [MTAThread]
        static void Main()
        {
            if (!String.IsNullOrEmpty(ThemeClass.Settings.EnforcedLanguage))
            {
                MyLog.Write(MyLog.LogType.Message, "Culture settings", "Started manual.");
                System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(ThemeClass.Settings.EnforcedLanguage);
                MobileGlobalization.CurrentUICulture = ci;

                try
                {
                    MyLog.Write(MyLog.LogType.Message, "Culture settings", "Try to set: " + ThemeClass.Settings.EnforcedLanguage);

                    // Unfortunately some cultures are not supported by default in Compact framework ->
                    // it causes exception -> reset culture to english.
                    string lblTest = Close.Properties.Resources.PopupClose;
                }
                catch (Exception ex)
                {
                    System.Globalization.CultureInfo ci2 = new System.Globalization.CultureInfo("EN");
                    MobileGlobalization.CurrentUICulture = ci2;
                    MyLog.Write(MyLog.LogType.Error, "Culture settings", "Culture settings failed - reset to english");
                }
            }
            
            Application.Run(new MainForm());
        }
    }
}